package com.yidu.service.impl;

import com.yidu.entity.Book;
import com.yidu.mapper.BookMapper;
import com.yidu.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class BookServiceImpl implements BookService {
    @Autowired
    private BookMapper bookMapper;

    public void insertBook(Book book) {
        bookMapper.insertBook(book);
    }

    public void deleteBook(String bookId) {
        bookMapper.deleteBook(bookId);
    }

    public void updateBook(Book book) {
        bookMapper.updateBook(book);
    }

    public List<Book> selectBook(int page,int limit) {
        Map map = new HashMap();
        map.put("page",(page-1)*limit);
        map.put("limit",limit);
        return bookMapper.selectBook(map);
    }
}
